'''
Author: GY_books 2567610535@qq.com
Date: 2023-12-22 16:14:08
LastEditTime: 2024-11-07 19:27:26
LastEditors: GY_books 2567610535@qq.com
FilePath: \my-flask-api\config.py
描述: 头部注释配置模板
'''

#调试模式
################################################################################
################### 上传前需要把DEBUG改为False ##################################
################################################################################
DEBUG = True

#host
HOST = '127.0.0.1'

#运行端口
PORT = 8080

# 本地mysql密码 和线上不一样  
mysql_password = 'wgy!08cscs'
if DEBUG:
    mysql_password = '123456'

# #mysql数据库配置
MSQL_DB_CONFIG = {
	"host": "localhost",
	"port": 3306,
	"user": "root",
	"passwd": 123456,
	"db": "mydb",
	"charset": "utf8mb4"
}

import os
class Config(object):
    # DEBUG = False
    JSON_AS_ASCII = False
    # 设置SECRET_KEY
    SECRET_KEY = os.urandom(24)  # 随机字符串


class DevelopmentConfig(Config):
    """开发环境"""
    DEBUG = True
    SQLALCHEMY_DATABASE_URI = 'localhost'
    # 是否追踪数据库修改，一般不开启, 会影响性能
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 是否显示底层执行的SQL语句
    SQLALCHEMY_ECHO = True


class ProductionConfig(Config):
    """生产环境"""
    SQLALCHEMY_DATABASE_URI = 'localhost:3306'
    # 是否追踪数据库修改，一般不开启, 会影响性能
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 是否显示底层执行的SQL语句
    SQLALCHEMY_ECHO = False


class TestingConfig(Config):
    """测试环境"""
    TESTING = True


# 映射环境对象
config_env = {
    'development': DevelopmentConfig,
    'production': ProductionConfig,
    'testing': TestingConfig
}
